import textMap from "@/utils/TextMap.js"
import c from "@/utils/Constant.js"

const timeUnits = ["分种","小时","天","个月","年"]
export default{
	parseContent(message){
		let msgCon = JSON.parse(message.content);
		if(message.type == c.action.NO_SPEAK){ //禁言
			return `你因${msgCon.reason},已被禁言${msgCon.timeNum}${timeUnits[msgCon.timeUnit-1]}`;
		}else if(message.type == c.action.NORMAL_SPEAK ){//解除禁言
			return  "你的账号已解除禁言";
		}else if(msgCon.entityType == c.entityType.TOPIC && message.type == c.action.NOT_APPROVED){//话题审核不通过
			return `你的话题审核不通过,理由:${msgCon.reason}`;	
		}else if(msgCon.entityType == c.entityType.COMMENT &&  message.type == c.action.NOT_APPROVED){//评论审核不通过
			return `你的评论审核不通过,理由:${msgCon.reason}`;	
		}else if(msgCon.entityType == c.entityType.TOPIC &&  message.type == c.action.APPROVED){//话题审核通过
			return "你的话题审核通过";
		}else if(msgCon.entityType == c.entityType.COMMENT &&  message.type == c.action.APPROVED){//评论审核通过
			return "你的评论审核通过";
		}
		return "";
	},
	parseTitle(message,triggerNickname){
		let msgCon = JSON.parse(message.content);
		if(message.type == c.action.FOLLOW){//关注
			return `<b>${triggerNickname}</b>关注了你`;
		}else if(msgCon.entityType == c.entityType.TOPIC &&  message.type == c.action.REPLY){//回复话题
			return `<b>${triggerNickname}</b>回复了你的话题`;
		}else if(msgCon.entityType == c.entityType.COMMENT &&  message.type == c.action.REPLY){//回复评论
			return `<b>${triggerNickname}</b>回复了你的评论`;
		}else if(msgCon.entityType == c.entityType.TOPIC &&  message.type == c.action.LIKE){//点赞话题
			return `<b>${triggerNickname}</b>点赞了你的话题`;
		}else if(msgCon.entityType == c.entityType.COMMENT &&  message.type == c.action.LIKE){//点赞评论
			return `<b>${triggerNickname}</b>点赞了你的评论`;
		}
	}
	
}